<!DOCTYPE HTML>
<html>
	<head>
		<title>万家代理管理</title>
		{{template "inc/mate.html" .}}
	    {{template "inc/easyui_css.html" .}}
	    {{template "inc/ie_supper.html" .}}
	</head>
	<body class="easyui-layout">
		<div data-options="region:'north'" style="height:50px">
			<h2 style="margin: 0px; margin-left: 20px; line-height: 50px; float: left;">万家代理后台</h2>

			<!--其他功能-->
			<ul style="float: right; padding: 0; margin: 0; list-style: none;">
				<li style="display: inline-block; position: relative;">
					<a href="javascript:;" id="a_up_pwd" style="color: #999c9e; font-weight: 600; font-size: 14px; padding-right: 15px; line-height: 50px; display: block; text-decoration: none; outline: 0; cursor: pointer;">修改密码</a>
				</li>
			</ul>
		</div>
		<div data-options="region:'west'" title="功能菜单" style="width:165px;">
			<div class="easyui-accordion" style="width:100%;">
		        {{if .LoginInfo.MenuAuths}}
		        {{range $i,$j:=.LoginInfo.MenuAuths}}
		        	{{with $TmpVal1:=c2int $j.AuthShowStatus}}
		        	{{else}}
		        		{{with $TmpVal2:=c2int $j.AuthPreId}}
		        		{{else}}
			        		<div title="{{$j.AuthName}}" style="padding:0px; margin: 0px;">
			        			<ul class="easyui-tree">
			        				{{range $k,$v:=$.LoginInfo.MenuAuths}}
			        					{{if eq $v.AuthPreId $j.AuthId}}
			        						{{with $TmpVal3:=c2int $v.AuthShowStatus}}
		        							{{else}}
				        						{{if $v.AuthUrl}}
				        							<li><a style="color:#595959;text-decoration: none;" href="javascript:addTab('{{$v.AuthUrl}}','{{$v.AuthName}}');">{{$v.AuthName}}</a></li>
				        						{{else}}
				        							<li><a style="color:#595959;text-decoration: none;" href="javascript:addTab('','');">{{$v.AuthName}}</a></li>
				        						{{end}}
			        						{{end}}
			        					{{end}}
			        				{{end}}
			        			</ul>
			        		</div>
						{{end}}
					{{end}}
		        {{end}}
		        {{end}}
			</div>
		</div>
		<div data-options="region:'center'">
			<div id="contab" class="easyui-tabs" data-options="plain:true" style="width:100%;height:100%">

				<div title="About" style="padding:10px">
		            <p style="font-size:14px">jQuery EasyUI framework helps you build your web pages easily.</p>
		            <ul>
		                <li>easyui is a collection of user-interface plugin based on jQuery.</li>
		                <li>easyui provides essential functionality for building modem, interactive, javascript applications.</li>
		                <li>using easyui you don't need to write many javascript code, you usually defines user-interface by writing some HTML markup.</li>
		                <li>complete framework for HTML5 web page.</li>
		                <li>easyui save your time and scales while developing your products.</li>
		                <li>easyui is very easy but powerful.</li>
		            </ul>
		        </div>

    		</div>
		</div>
		<div data-options="region:'south'" style="height:25px; text-align: center;">
			技术支持：迷路的阿修罗
		</div>
		<div id="dlg_up_pwd" class="easyui-dialog" data-options="closable: true,closed:true,draggable:false,resizable:false,modal:true" style="width:350px;padding:20px 20px; height:350px; ">
			<!--{{.baseUrl}}/agent/upPwd-->
			<form id="up_ff" method="post" action="{{.baseUrl}}/agent/upPwd" class="easyui-form" data-options="novalidate:true">
				<div style="margin-bottom:20px">
	                <input class="easyui-passwordbox" prompt="旧密码" data-options="required:true,validType:'length[6,12]',missingMessage:'旧密码不可以为空',invalidMessage:'旧密码必须6到12位'" name="opwd" id="opwd" iconWidth="28" style="width:100%;height:34px;padding:10px" />
	            </div>
	            <div style="margin-bottom:20px">
	                <input class="easyui-passwordbox" prompt="新密码" data-options="required:true,validType:'length[6,12]',missingMessage:'新密码不可以为空',invalidMessage:'新密码必须6到12位'" name="npwd" id="npwd" iconWidth="28" style="width:100%;height:34px;padding:10px" />
	            </div>
	            <div style="text-align:center;padding:5px 0;">
	                <a href="javascript:void(0)" class="easyui-linkbutton" id="btn_up_submit" style="width:80px; border-color: #4cae4c; background-image: linear-gradient(rgb(76,174,76) 0px, rgb(68,157,68) 100%);">修改</a>
	                <a href="javascript:void(0)" class="easyui-linkbutton" id="btn_up_clear" style="width:80px;">重设</a>
	            </div>
	        </form>
    	</div>
	</body>
	{{template "inc/easyui_js.html" .}}
	<script type="text/javascript">
		function addTab(url,name){
			if (url==""||name=="") {
				return
			}
			if ($('#contab').tabs('exists',name)){
				$('#contab').tabs('select', name);
			}else{
				var allHeight=document.documentElement.clientHeight;
				var height=allHeight-114;
				$('#contab').tabs('add',{
	                title: name,
	                //href:url,
	                content:' <iframe scrolling="yes" frameborder="0"  src="'+url+'" style="width:100%;height:'+height+'px;"></iframe>',
	                closable: true
	            });
			}
		}
		$(document).ready(function(){
			//修改密码
			$("#a_up_pwd").click(function(){
				$('#dlg_up_pwd').dialog({
				    title:'修改密码',
				    // content:"修改密码",
				    closable: true,
				    closed:true,
				    draggable:false,
				    resizable:false,
				    modal:true,
					onBeforeOpen:function(){
						$("#npwd").val("");
	            		$("#opwd").val("");
					}
				});
				$('#dlg_up_pwd').dialog('open')
			});
			$("#btn_up_submit").click(function(){
	            $('#up_ff').form('submit',{
	                onSubmit:function(){
	                    return $(this).form('enableValidation').form('validate');
	                },
	                success:function(data){
	                	var data = eval('(' + data + ')');
	                	if (data.result) {
							alert("修改密码成功，请重新登录！");
							$('#dlg_up_pwd').dialog('close')
							window.open("{{.baseUrl}}");
						}else{
							alert(data.msg);
						}
	                }
	            });
	        });
	        $("#btn_up_clear").click(function(){
	            $("#up_ff").form({
	                novalidate:true
	            });
	            $("#ff").form("clear");
	        });
		});
	</script>
</html>